<!DOCTYPE html>
<html lang="en">
	<head>
	    <meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	    <meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title><?php echo $sys_name; ?>
			   <?php echo '- '.$title_for_layout; ?>
		</title>

		<!--[if lt IE 9]>
      		<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
    	<![endif]-->
		<style>
     		 body {
        		padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      		}
    	</style>
    	<?php
    		//Load Bootstrap:  
    		echo $this->Bootstrap->load(); 
    		echo $this->Html->script('jquery-1.9.0.min.js');
    		echo $this->Html->script('jquery-ui-1.10.3.custom.js');
    		echo $this->Html->script('jquery.cookie.js');
    		echo $this->Html->script('jquery.cookie.js');
    		echo $this->Html->script("twitter/bootstrap/bootstrap.min.js");
    		echo $this->Html->css('smoothness/jquery-ui-1.10.3.custom.css');
    		echo $this->Html->css('jquery-ui-timepicker-addon.css');
    		echo $this->Html->css('custom.css');
			echo $this->fetch('meta');
			echo $this->fetch('css');
			echo $this->fetch('script');
    	?>
		<script type="text/javascript">
		jQuery(function(){
			$(".alert").alert();
			$('#home').hover(function(){
				//$('#home').addClass('icon-white');
			});
		});
		</script>
	</head>
	<body>
		<div>
			<div class="container" id="container-topo">
				<div class=span2>
				<?php echo $this->Html->image('logo_no-back_ABE.png', array('class'=>'logo-topo'));?>
				</div>
				<div class='text-center span7' id="nome-topo">
					<div>Associação Brasileira de Estatítica</div>
					<div><?php echo $sys_name; ?></div>
				</div>
			</div>
		</div>
	    <div class="navbar navbar-inverse">
	      <div class="navbar-inner">
	        <div class="container-fluid">
	          <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
	            <span class="icon-bar"></span>
	            <span class="icon-bar"></span>
	            <span class="icon-bar"></span>
	          </a>
	          <span class="brand">Scige</span>
	          <div class="container-fluid nav-collapse">
	          	<p class="navbar-text pull-right">
	          	<?php if(!isset($login_page)){
						 if (isset($usuario_sessao)){
							echo 'Bem vindo ';
							echo $this->Html->link($usuario_sessao['login'], '/');
							echo __(' ('.$this->Html->link(__('Sair'), '/logout').')');
						 
						 }
					   	 else 
							echo $this->Html->link(__('Fazer login'), array('controller' => 'login'));
				} ?>
				</p> 
	            <ul class="nav">
	            	<li><?php echo $this->Html->link('<i class="icon-home icon-white" id=home></i>', '/home', array('escape'=>false)); ?></li>
	                <li><?php echo $this->Html->link(__('Datas Importantes'), '/datas_importantes'); ?></li>
	                <li><?php echo $this->Html->link(__('Taxas'), '/precos'); ?></li>
	                <li><?php echo $this->Html->link(__('Fazer cadastro'), '/registro'); ?></li>
	                <?php $menu = $this->requestAction('/userpages/menu'); ?>
							<?php foreach ($menu as $entry){
								echo '<li>'.$this->Html->link($entry['Userpage']['titulo'],'/paginas/'.$entry['Userpage']['caminho']).'</li>';
					}?>
	                <li class="dropdown">
						<a class="dropdown-toggle" data-toggle="dropdown" href="#"><?php echo __('Mais');?> <b class="caret"></b></a>
						<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
						 <?php $menu = $this->requestAction('/userpages/menu_mais'); ?>
							<?php foreach ($menu as $entry){
								echo '<li>'.$this->Html->link($entry['Userpage']['titulo'],'/paginas/'.$entry['Userpage']['caminho']).'</li>';
							}?>
						</ul>
					</li>
				</ul>
	          </div><!--/.nav-collapse -->
	        </div>
	      </div>
	    </div>
		
		<?php if(!$usuario_sessao){?>
		<div class="jumbotron masthead">
	    </div>
	    <?php }?>
	    <div class="container">
	      <?php if(!$usuario_sessao){?>
	      <div class="content">
	      	<div class="row">
	          <div id="main-content" class="span12">
	            <?php echo $this->Session->flash(); ?>
			    <?php echo $this->fetch('content'); ?>
			  </div>
			</div>
	      </div>
	      <?php } else {?>    
	      <div class="content">
	        <div class="row">
	            <div class="span3">
	              <div class="well sidebar-nav">
	                <ul class="nav nav-list">
	                  <?php if(!$usuario_sessao){
							echo $this->element('menu/publico');
						} 
						else if($usuario_sessao && $usuario_sessao['tipo'] == ADMIN || $usuario_sessao['tipo'] == ADMIN_LOCAL){
							echo $this->element('menu/admin');
						}else if($usuario_sessao && $usuario_sessao['tipo'] == USUARIO){
							echo $this->element('menu/usuario');
						}else if($usuario_sessao && $usuario_sessao['tipo'] == REVISOR){
							echo $this->element('menu/revisor');
						}else if($usuario_sessao && $usuario_sessao['tipo'] == RECEPCIONISTA){
							echo $this->element('menu/recepcionista');
						}
						$menu = $this->requestAction('/userpages/menu');
						?>
	                </ul>
	              </div><!--/.well -->
	            </div><!--/span-->

	           	<div id="main-content" class="span9">

					<?php echo $this->Session->flash(); ?>

					<?php echo $this->fetch('content'); ?>

	            </div><!--/span-->

	        </div><!--/row-->
	      </div><!--/content-->
	      <?php }?>
	      <br><br>
	      <div class="footer">
	      	<div class="container">
	      		<div class="row">
					<div class="span4 text-center">
						<p class='muted'><?php echo __('Patrocínio');?></p>
						<div class="row">
						<?php $patrocinadores = $this->requestAction('/patrocinadores/lista');?>
						<?php foreach($patrocinadores as $item){?>
						<div class="span2">
							<a href="http://<?php echo $item['Patrocinador']['link'];?>" class="thumbnail muted" target="_blank">
								<?php echo $this->Html->image('patrocinadores/'.$item['Patrocinador']['imagem'], array('height'=>'90'));?>
								<?php echo $item['Patrocinador']['nome'];?>
							</a>
						</div>
						<?php }?>
						</div>
					</div>
					<div class="span4 text-center">
						<p class='muted'><?php echo __('Organização');?></p>
						<div class="row">
						<?php $organizadores = $this->requestAction('/organizadores/lista');?>
						<?php foreach($organizadores as $item){?>
						<div class="span2">
							<a href="http://<?php echo $item['Organizador']['link'];?>" class="thumbnail muted" target="_blank">
								<?php echo $this->Html->image('organizadores/'.$item['Organizador']['imagem'], array('height'=>'90'));?>
								<?php echo $item['Organizador']['nome'];?>
							</a>
						</div>
						<?php }?>
						</div>
					</div>
					<div class="span4 text-center">
						<p class='muted'><?php echo __('Apoio');?></p>
						<div class="row">
						<?php $apoiadores = $this->requestAction('/apoiadores/lista');?>
						<?php foreach($apoiadores as $item){?>
						<div class="span2">
							<a href="http://<?php echo $item['Apoiador']['link'];?>" class="thumbnail muted" target="_blank">
								<?php echo $this->Html->image('apoiadores/'.$item['Apoiador']['imagem'], array('height'=>'90'));?>
								<?php echo $item['Apoiador']['nome'];?>
							</a>
						</div>
						<?php }?>
						</div>
					</div>
				</div>
				<p class="text-center">&copy; GwD - Sistemas Gerenciais e Analíticos <?php echo date('Y'); ?></p>
	        </div>
	      </div>
<?php echo $this->element('sql_dump'); ?>
	    </div> <!-- /container -->
	</body>
</html>
